﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MvcEngine.Core.Validation;
using MvcEngine.Core.Base;
using System.Xml.Linq;
using MvcEngine.Core.Utils;

namespace MvcEngine.Core.Website
{
    public class Site : Entity
    {
        public Guid Id { get; set; }

        public string Name { get; set; }

        public string Description
        {
            get { return (string)Fields.GetValue("Description"); }
            set { Fields.SetValue("Description", value); }
        }

        public Guid DefaultPage
        {
            get { return (Guid)Fields.GetValue("DefaultPage"); }
            set { Fields.SetValue("DefaultPage", value); }
        }

        public Guid SkinId { get; set; }

        public int RegistrationType
        {
            get { return (int)Fields.GetValue("RegistrationType"); }
            set { Fields.SetValue("RegistrationType", value); }
        }

        public string Culture
        {
            get { return (string)Fields.GetValue("Culture"); }
            set { Fields.SetValue("Culture", value); }
        }

        public Guid? LoginPage
        {
            get { return (Guid?)Fields.GetValue("LoginPage"); }
            set { Fields.SetValue("LoginPage", value); }
        }

        public Guid? AccountPage
        {
            get { return (Guid?)Fields.GetValue("AccountPage"); }
            set { Fields.SetValue("AccountPage", value); }
        }

        public IList<MenuItem> Menu
        {
            get { return (IList<MenuItem>)Fields.GetValue("Menu"); }
            set { Fields.SetValue("Menu", value); }
        }

        public string FooterText
        {
            get { return (string)Fields.GetValue("FooterText"); }
            set { Fields.SetValue("FooterText", value); }
        }

        public string HeaderText
        {
            get { return (string)Fields.GetValue("HeaderText"); }
            set { Fields.SetValue("HeaderText", value); }
        }

        public string Email
        {
            get { return (string)Fields.GetValue("Email"); }
            set { Fields.SetValue("Email", value); }
        }

        public string SmtpUserName
        {
            get { return (string)Fields.GetValue("SmtpUserName"); }
            set { Fields.SetValue("SmtpUserName", value); }
        }

        public string SmtpPassword
        {
            get { return (string)Fields.GetValue("SmtpPassword"); }
            set { Fields.SetValue("SmtpPassword", value); }
        }

        public string SmtpServer
        {
            get { return (string)Fields.GetValue("SmtpServer"); }
            set { Fields.SetValue("SmtpServer", value); }
        }

        public int SmtpServerPort
        {
            get { return GetValue<int>("SmtpServerPort", 25); }
            set { Fields.SetValue("SmtpServerPort", value); }
        }


        public override string Xml { get; set; }

        public Guid? CreatedBy { get; set; }

        public DateTime CreatedDate { get; set; }

        public Guid? ModifiedBy { get; set; }

        public DateTime ModifiedDate { get; set; }
    }
}
